import request from '@/config/axios'

export interface HousingResourceVO {
  id: number
  title: string
  area: string
  houseType: string
  auctionNumber: string
  marketPrice: string
  marketUnitPrice: string
  pickupSpacePrice: string
  startingPrice: string
  startingOddPrice: string
  discount: string
  cellName: string
  step: string
  floor: string
  propertyType: string
  numberOfAuctions: number
  earnestMoney: string
  bidIncrement: string
  discountRate: string
  architectureYear: string
  decorateSituation: string
  address: string
  district: string
  longitude: string
  latitude: string
  imagesList: string
  auctionState: number
  housingType: number
}

// 查询房源信息列表
export const getHousingResourcePage = async (params) => {
  return await request.get({ url: `/hutai/housing-resource/page`, params })
}

// 查询房源信息详情
export const getHousingResource = async (id: number) => {
  return await request.get({ url: `/hutai/housing-resource/get?id=` + id })
}

//查询客服电话
export const getHousingMobile = async () => {
  return await request.get({ url: `/hutai/housing-resource/getHousingMobile`})
}



// 新增房源信息
export const createHousingResource = async (data: HousingResourceVO) => {
  return await request.post({ url: `/hutai/housing-resource/create`, data })
}

// 修改房源信息
export const updateHousingResource = async (data: HousingResourceVO) => {
  return await request.put({ url: `/hutai/housing-resource/update`, data })
}

export const updateHousingMobile = async (data) => {
  return await request.put({ url: `/hutai/housing-resource/updateMobile`, data })
}


// 删除房源信息
export const deleteHousingResource = async (id: number) => {
  return await request.delete({ url: `/hutai/housing-resource/delete?id=` + id })
}

// 导出房源信息 Excel
export const exportHousingResource = async (params) => {
  return await request.download({ url: `/hutai/housing-resource/export-excel`, params })
}


//获取房源最近的更新时间
export const getHousingUpdateTime = async (type) => {
  return await request.get({ url: `/hutai/housing-resource/getHousingUpdateTime?type=`+type})
}
